# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: dorphell <dorphell@archlinux.org>

pkgname=dillo
pkgver=3.0.5
pkgrel=12
pkgdesc="A small, fast graphical web browser built on FLTK"
arch=(loong64 x86_64)
url="https://www.dillo.org"
license=('GPL')
depends=('fltk' 'libjpeg' 'libpng' 'openssl' 'perl' 'zlib')
backup=(etc/dillo/{dillorc,domainrc,dpidrc,keysrc})
validpgpkeys=('D91CE08D8679CF2A6F8792E05B1004E936929CEE')
source=(https://www.dillo.org/download/$pkgname-$pkgver.tar.bz2{,.asc}
        openssl.patch
        dillo.desktop
        https://www.dillo.org/Icons/ProgramIcon128.png)
sha256sums=('db1be16c1c5842ebe07b419aa7c6ef11a45603a75df2877f99635f4f8345148b'
            'SKIP'
            'ddd097b30b95a5ac5638f57d04dc2e421d5c2fa3d0985747921e1bfc5b55fb23'
            'e94ead3a359c2eceb934b07af0fac4864251b9721fa7f4855331daa017b66202'
            '72ecb57983117b17f0777caf6cf935a2ad5d72aca7b07b11f5b75562cb420778')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  patch -Np1 -i ../openssl.patch
  autoreconf -fi
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure --prefix=/usr --sysconfdir=/etc --enable-cookies --enable-ssl
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install

  install -Dm644 ../dillo.desktop "$pkgdir/usr/share/applications/dillo.desktop"
  install -Dm644 ../ProgramIcon128.png "$pkgdir/usr/share/pixmaps/dillo.png"
}
